package com.nsgf.library.ui.page;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;

import com.kunminx.architecture.ui.page.DataBindingConfig;
import com.nsgf.library.BR;
import com.nsgf.library.R;
import com.nsgf.library.databinding.ActivitySearchBinding;
import com.nsgf.library.utils.ToastUtils;

public class SearchMessageActivity extends BaseActivity {

    StateHolder mState;

    private ActivitySearchBinding mBinding;

    @Override
    protected void initViewModel() {
        mState = getActivityScopeViewModel(StateHolder.class);

    }

    @Override
    protected DataBindingConfig getDataBindingConfig() {
        return new DataBindingConfig(R.layout.activity_search, BR.vm, mState)
            .addBindingParam(BR.click, new ClickProxy());
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mBinding = (ActivitySearchBinding) getBinding();
        mBinding.titlebar.titleBarRoot.setText("搜索");
    }

    public class ClickProxy {

        public void search() {
            Intent intent = new Intent();
            intent.putExtra("search", mState.searchContent.get());
            setResult(RESULT_OK, intent);
            finish();
        }
    }
}
